package com.cdxy.controller;


import com.cdxy.biz.process.IHotSearchBizProcess;
import com.cdxy.model.dto.base.controller.BaseController;
import com.cdxy.model.dto.base.resp.ApiResponse;
import com.cdxy.model.dto.base.resp.BasePageResp;
import com.cdxy.model.dto.req.SearchResultReq;
import com.cdxy.model.dto.resp.SearchResultResp;
import com.cdxy.service.IHotSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 热门搜索 前端控制器
 * </p>
 *
 * @author autoGenCode
 * @since 2020-03-05
 */
@RestController
@RequestMapping("/hotSearch")
@Api(tags = "热门搜索")
public class HotSearchController extends BaseController {

    @Autowired
    private IHotSearchBizProcess hotSearchBizProcess;

    @PostMapping("/search")
    @ApiOperation(value = "搜索结果")
    public ApiResponse<BasePageResp<SearchResultResp>> search(@Validated @RequestBody SearchResultReq searchResultReq) {
        return successApiResponse(hotSearchBizProcess.searchResult(searchResultReq));
    }

}
